import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 保养统计信息 */
export interface UpkeepStatics {
          id: number; // 主键
          accountId?: number; // 模具台账id
          drawingNoId?: number; // 图号id
          upkeepId: number; // 保养类型id
          upkeepCounts: number; // 保养次数
          upkeepTotalTime: number; // 保养工时
          status: number; // 任务状态
  }

// 保养统计 API
export const UpkeepStaticsApi = {
  // 查询保养统计分页
  getUpkeepStaticsPage: async (params: any) => {
    return await request.get({ url: `/mold/upkeep-statics/page`, params })
  },

  // 查询保养统计详情
  getUpkeepStatics: async (id: number) => {
    return await request.get({ url: `/mold/upkeep-statics/get?id=` + id })
  },

  // 新增保养统计
  createUpkeepStatics: async (data: UpkeepStatics) => {
    return await request.post({ url: `/mold/upkeep-statics/create`, data })
  },

  // 修改保养统计
  updateUpkeepStatics: async (data: UpkeepStatics) => {
    return await request.put({ url: `/mold/upkeep-statics/update`, data })
  },

  // 删除保养统计
  deleteUpkeepStatics: async (id: number) => {
    return await request.delete({ url: `/mold/upkeep-statics/delete?id=` + id })
  },

  /** 批量删除保养统计 */
  deleteUpkeepStaticsList: async (ids: number[]) => {
    return await request.delete({ url: `/mold/upkeep-statics/delete-list?ids=${ids.join(',')}` })
  },

  // 导出保养统计 Excel
  exportUpkeepStatics: async (params) => {
    return await request.download({ url: `/mold/upkeep-statics/export-excel`, params })
  },
}